<template>
    <div class="layout">
        <router-view></router-view>
        <footer>
            <div class="bottom-list">
                <router-link to="/index" :class="{ active: isActive('/fenlei')||isActive('/bangdan')||isActive('/shuku') }">
                    <van-icon name="wap-home-o" />
                    <p>主页</p>
                </router-link>
                <router-link to="/list" :class="{ active: isActive('/list') }">
                    <van-icon name="shopping-cart-o" />
                    <p>书架</p>
                </router-link>
                <router-link to="/my" :class="{ active: isActive('/my') }">
                    <van-icon name="user-o" />
                    <p>我的</p>
                </router-link>
            </div>
        </footer>
    </div>
</template>
<style lang="less" scoped>
footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    border-top: 1px solid #ccc;
    background-color: turquoise;
    .bottom-list {
        display: flex;
        padding: 5px;
        justify-content: space-around;

        a {
            position: relative;
            height: 64.78px;
            width: 100%;
            text-align: center;

            p {
                font-weight: bold;
                color: white;
                font-size: 18px;
                position: absolute;
                bottom: 0;
                left: 50%;
                padding: 0 10px;
                transform: translateX(-50%);
            }

            

            i {
                font-size: 40px;
                color: white;
            }
        }
        .active {
               p{
                color: black;
                border-radius: 5px;
               }
               i{
                font-weight: bold;
                color: black;
               }
            }
    }
}
</style>
<script>
export default {
    data() {
        return {

        }
    },
    methods: {
        isActive(routePath) {
            return this.$route.path === routePath;
        }
    }
}
</script>
